package com.sth.springframework.test;

import com.sth.springframework.beans.factory.config.BeanDefinition;
import com.sth.springframework.beans.factory.support.DefaultListableBeanFactory;
import com.sth.springframework.test.bean.UserService;
import org.junit.Test;

/**
 * @Author: sitianhong
 * @Description:
 * @Since: create in 2021/8/27 0027 22:08
 */
public class ApiTest2 {
    @Test
    public void testi() {
        DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
        BeanDefinition beanDefinition = new BeanDefinition(UserService.class);
        beanFactory.registerBeanDefinition("userService", beanDefinition);

        UserService userService = (UserService) beanFactory.getBean("userService");
        userService.queryUserInfo();

        UserService userService2 = (UserService) beanFactory.getBean("userService");
        userService2.queryUserInfo();

    }

}
